home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
wtjmarch.zip
/
DEBUGWIN.ZIP
/
DEBUGWIN.PAS
next >
Wrap
Pascal/Delphi Source File
|
1992-02-21
|
2KB
|
60 lines
LISTING 1: DEBUGWIN.PAS
This program creates a window to hold messages from the program being debugged.
{$S-,R-}
program DebugWin;
uses
Strings, WinTypes, WinProcs, WinCrt;
const
dwTitle = 'Debug Window';
wmsDebugString = 'wm_DebugString';
var
wm_DebugString : Word; {message codes}
CrtWindow : hWnd; {WinCrt's window handle}
CrtWinProc : TFarProc; {WinCrt's window proc}
dwWinProc : TFarProc; {our window proc}
function OurWinProc(HW : hWnd; Msg, wParam : Word;
lParam : Longint) : Longint; export;
{-Our specialized window procedure. lParam is a
pointer to a string of characters. wParam is the
number of characters in the string}
begin
if Msg = wm_DebugString then begin
{process special message}
WriteBuf(PChar(lParam), wParam);
OurWinProc := 0;
end
else
{pass message to the regular window procedure}
OurWinProc := CallWindowProc(CrtWinProc, HW, Msg, wParam, lParam);
end;
begin
{check to see if we're already loaded}
if hPrevInst <> 0 then begin
{we're already loaded--find our window}
CrtWindow := FindWindow('TPWinCrt', dwTitle);
if (CrtWindow <> 0) and IsIconic(CrtWindow) then
ShowWindow(CrtWindow, sw_ShowNormal);
Halt;
end;
ScreenSize.X := 80;
ScreenSize.Y := 65520 div 80;
WindowSize.X := GetSystemMetrics(sm_CXScreen);
WindowSize.Y := 100;
WindowOrg.X := 0;
WindowOrg.Y := 0;
StrCopy(WindowTitle, dwTitle);
InactiveTitle := dwTitle;
InitWinCrt;
CrtWindow := FindWindow('TPWinCrt', dwTitle);
dwWinProc := MakeProcInstance(@OurWinProc, hInstance);
CrtWinProc := TFarProc(SetWindowLong(CrtWindow, gwl_WndProc, LongInt(dwWinProc)) );
wm_DebugString := RegisterWindowMessage(wmsDebugString);
end.